package router

import (
    "github.com/gin-gonic/gin"
    "server/controller/ArticleCategoryController"
    "server/controller/ArticleController"
    "server/controller/HomeController"
    "server/controller/LostFoundController"
    "server/controller/TourController"
    "server/controller/WebLinkController"
)

//注册路由
func Register(engine *gin.Engine) {
    root := engine.Group("/api") //接口根路径
    homeRouter(root)
    articleCategoryRouter(root)
    articleRouter(root)
	webLinkRouter(root)
    lostFoundRouter(root)
    tourRouter(root)
}

//注册主页路由
func homeRouter(root *gin.RouterGroup) {
    group := root.Group("/home")
    group.POST("/findContentDicList", HomeController.FindContentDicList)
}

//注册文章类型路由
func articleCategoryRouter(root *gin.RouterGroup) {
    group := root.Group("/articleCategory")
    group.POST("/findList", ArticleCategoryController.FindList)
}

//注册文章路由
func articleRouter(root *gin.RouterGroup) {
    group := root.Group("/article")
    group.POST("/findById", ArticleController.FindById)
    group.POST("/findPageList", ArticleController.FindPageList)
    group.POST("/findList", ArticleController.FindList)
    group.POST("/findYaoList", ArticleController.FindYaoList)
    group.POST("/findSlideList", ArticleController.FindSlideList)
}

//注册友情链接路由
func webLinkRouter(root *gin.RouterGroup) {
	group := root.Group("/webLink")
	group.POST("/findList", WebLinkController.FindList)
}

//注册失物招领路由
func lostFoundRouter(root *gin.RouterGroup) {
    group := root.Group("/lostFound")
    group.POST("/findPageList", LostFoundController.FindPageList)
}

//注册旅游景点路由
func tourRouter(root *gin.RouterGroup) {
    group := root.Group("/tour")
    group.POST("/findTourList", TourController.FindTourList)
    group.POST("/findHomeTourList", TourController.FindHomeTourList)
}

